package com.citydo.webrtcspringboot.transfer.mqtt;

import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.stereotype.Component;
import org.eclipse.paho.client.mqttv3.IMqttMessageListener;

//消息处理器类，用于处理接收到的 MQTT 消息
@Component
@Slf4j
public class MqttMessageHandler implements IMqttMessageListener{
    public MqttMessageHandler(){
    }
    @Override
    public void messageArrived(String topic, MqttMessage message) throws Exception{
        log.info("Received message from topic: " + topic);
        log.info("Message: " + new String(message.getPayload()));
    }
}
